# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=gr-dect2
pkgver=39.0d973fe
pkgrel=1
pkgdesc='Real-time DECT voice channel decoding by Gnuradio.'
arch=('x86_64' 'aarch64')
groups=('blackarch' 'blackarch-radio' 'blackarch-sniffer')
url='https://github.com/pavelyazev/gr-dect2'
license=('custom:unknown')
depends=('gnuradio' 'gnuradio-osmosdr' 'hackrf')
makedepends=('git' 'cmake' 'doxygen' 'pybind11' 'swig' 'boost-libs' 'boost')
source=("git+https://github.com/pavelyazev/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  ( set -o pipefail
    git describe --long --tags --abbrev=7 2>/dev/null |
      sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
    printf "%s.%s" "$(git rev-list --count HEAD)" \
      "$(git rev-parse --short=7 HEAD)"
  )
}

build() {
  cd $pkgname

  mkdir -p build
  cd build
  cmake \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_BUILD_TYPE=release \
  ..
  make
}

package() {
  cd $pkgname/build

  make DESTDIR="$pkgdir" install

  cd ..
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" *.md
}

